package at.ac.tuwien.sepm.s2011.e0208329.dao;

import static org.junit.Assert.*;

import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import at.ac.tuwien.sepm.s2011.e0208329.db.DatabaseManager;

public class OrderDAOImplTest {
	private DatabaseManager dbm;
	private OrderDAOImpl orderDAO;

	@Before
	public void setUp() throws Exception {
		dbm = DatabaseManager.getDatabaseManager();
		dbm.getConnection().setAutoCommit(false);
		orderDAO = DAOFactoryImpl.getDAOFactory().getOrderDAO();
	}

	@After
	public void tearDown() throws Exception {
		dbm.getConnection().rollback();
	}

	@Test(expected = SQLIntegrityConstraintViolationException.class)
	public void testStoreSingleOrderItem() throws SQLException{
		orderDAO.storeSingleOrderItem(99,2,5);
	}

}
